package com.sfdk.graphics.engine.data
{
    import com.sfdk.utils.IntPoint;

    import flash.utils.Dictionary;

    public class CharacterDefinition
    {
        private var _characterData : XML;

        private var _spriteName:String;
        private var _name:String;
        private var _class:String;
        private var _startingPosition:IntPoint;
        private var _stats:Dictionary;

        public function CharacterDefinition(characterData : XML) {
            _characterData = characterData;
            init();
        }

        protected function init() : void
        {
            _spriteName = _characterData.@type;
            _name = _characterData.@name;
            _class = _characterData.@clss;

            _startingPosition = new IntPoint(_characterData.position.@x, _characterData.position.@y);
            _stats = new Dictionary();
            _stats["atk"] = _characterData.stats.@atk;
            _stats["def"] = _characterData.stats.@def;
            _stats["agi"] = _characterData.stats.@agi;
            _stats["mov"] = _characterData.stats.@mov;
            _stats["lv"] = _characterData.stats.@lv;
            _stats["hp"] = _characterData.stats.@hp;
            _stats["maxHp"] = _characterData.stats.@maxHp;
            _stats["mp"] = _characterData.stats.@mp;
            _stats["maxMp"] = _characterData.stats.@maxMp;
            _stats["exp"] = _characterData.stats.@exp;
        }

        public function get spriteName():String {
            return _spriteName;
        }

        public function get name():String {
            return _name;
        }

        public function get characterClass():String {
            return _class;
        }

        public function get startingPosition():IntPoint {
            return _startingPosition;
        }

        public function get stats():Dictionary {
            return _stats;
        }
    }
}
